<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>业务管理</title>
    <%@ include file="../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/validate/jquery.validate.custom.js?t=20181024"></script>
    <style>
        .right-btn{
            float: right;
            height: 25px;
            padding-top: 2px!important;
            margin-top: -7px;
        }
    </style>
    <script>
        var pBizCode = '${pBizCode}';
        var searchKey = '${searchKey}';
        var searchStatus = '${searchStatus}';
        var searchBizInfo = ${searchBizInfo};
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="tabs-container">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-search"></i> 筛选查询</h5>
                    </div>
                    <div class="ibox-content ibox-content-search">
                        <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">查询服务项：</label>
                                <div class="col-sm-5">
                                    <input type="text" name="bizName" onkeydown="if(event.keyCode==13){doRefresh();return false;}" id="bizName" class="form-control"  placeholder="输入服务项名称" maxlength="30">
                                </div>
                                <div class="ibox-tools ibox-tools-search">
                                    <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-3" style="padding-right: 0px;">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i> 业务信息</h5>
                    </div>
                    <div class="ibox-content">
                        <table class='table table-striped table-hover'
                               id="pDataTable"  data-height="400"
                               data-toggle="table"
                               data-url="${ctx}/biz/pageFindBizData?t=${now}"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getTypeParams"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="bizCode" data-visible="false">业务编码</th>
                                <th data-field="bizName" data-align="center" data-formatter="initCheck">业务名称</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-9">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="ibox-tools col-sm-offset-2">
                            <c:if test="${userType == 'super' || not empty btnMap['addChildBiz']}">
                                <button class="btn btn-primary btn-outline" onclick="openAddBizPage()">新增</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['editChildBiz']}">
                                <button class="btn btn-primary btn-outline" onclick="openEditBizPage()">编辑</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['delChildBiz']}">
                                <button class="btn btn-primary btn-outline" onclick="checkBizDelete()">删除</button>
                            </c:if>
                            <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                            <button class="btn btn-primary btn-outline" onclick="doBack()">返回</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class='table table-striped table-hover'
                               id="dataTable"  data-height="400"
                               data-toggle="table"
                               data-url="${ctx}/biz/pageFindChildBizData?t=${now}"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getParams"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="bizParentCode" data-visible="false">父业务编码</th>
                                <th data-field="status" data-visible="false">状态</th>
                                <th data-field="bizCode" data-visible="false">业务编码</th>
                                <th data-field="packageInfo" data-visible="false">服务包信息</th>
                                <th data-field="bizName" data-formatter="formatName" data-events="actionEvents" data-align="center">服务项名称</th>
                                <th data-field="isRequired" data-formatter="formatIsRequired" data-align="center" data-width="120px">是否为必备服务</th>
                                <th data-field="sortNum" data-align="center" data-width="90px">排序</th>
                                <th data-field="packageNames" data-align="center" data-width="160px">服务子项</th>
                                <th data-field="creator" data-formatter="formatterCreator" data-align="center" data-width="120px">创建人</th>
                                <th data-field="operator" data-formatter="formatterOperator" data-align="center" data-width="120px">编辑人</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center">${companyName}</div>
            </div>
        </div>
    </div>
</div>

<div id="editBizPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="_modelTitle" style="font-weight: normal;">新增服务项</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="_bizDataForm">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">业务类别：</label>
                        <label class="col-sm-7 control-label control-label-content" id="_parentBiz"></label>
                    </div>
                    <div class="form-group form-group-new">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>服务项编码：</label>
                        <div class="col-sm-7">
                            <input type="text" id="_bizCode" name="_bizCode" class="form-control" maxlength="20" required>
                            <span class="help-block m-b-none tip"></span>
                        </div>
                    </div>
                    <div class="form-group form-group-new">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>服务项名称：</label>
                        <div class="col-sm-7">
                            <input type="text" id="_bizName" name="_bizName" class="form-control" maxlength="20" required>
                            <span class="help-block m-b-none tip"></span>
                        </div>
                    </div>
                    <div class="form-group form-group-new">
                        <label class="col-sm-3 control-label"><span style="color: red">*</span>是否为必备服务：</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="_isRequired" id="_isRequired">
                                <option value="Y" >是</option>
                                <option value="N" >否</option>
                            </select>
                            <span class="help-block m-b-none tip"></span>
                        </div>
                    </div>
                    <div class="form-group form-group-new">
                        <label class="col-sm-3 control-label">排序：</label>
                        <div class="col-sm-7">
                            <input type="text" id="_sortNum" name="_sortNum" class="form-control" maxlength="9" isPInteger="true">
                            <span class="help-block m-b-none tip"></span>
                        </div>
                    </div>
                    <div class="form-group form-group-new">
                        <label class="col-sm-3 control-label">备注：</label>
                        <div class="col-sm-7">
                            <textarea type="text" id="remark" name="remark" class="form-control" maxlength="50" style="height: 80px; resize: none;" placeholder="50字以内"></textarea>
                            <span class="help-block m-b-none tip"></span>
                        </div>
                    </div>
                    <h5 class="page-header page-header-new"><i class="fa fa-file-text"></i>&nbsp;&nbsp;服务包
                        <button type="button" class="btn btn-primary right-btn" onclick="doDelPackage();">删除</button>
                        <button type="button" class="btn btn-primary right-btn" onclick="doAddPackage();">新增</button>
                    </h5>
                    <div id="_packageInfo">
                        <%--<div class="form-group form-group-new" id="div_1_name">
                            <label class="col-sm-3 control-label">
                                <input type="checkbox" name="_package" value="1_name" />
                                <span style="color: red">*</span>服务包名称：
                            </label>
                            <div class="col-sm-7">
                                <input type="text" id="name1" name="packageName" class="form-control" maxlength="20" placeholder="20个字内" required>
                                <input type="hidden" id="code1" name="packageCode" class="form-control">
                                <span class="help-block m-b-none tip"></span>
                            </div>
                        </div>--%>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doSaveBiz()">保存</button>
                <button class="btn btn-white" onclick="closeEditBizPage();">取消</button>
            </div>
        </div>
    </div>
</div>

<div id="bizInfoPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 style="text-align: center; font-weight: normal;">服务项详情</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="_bizDataForm1" novalidate="novalidate">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">业务类别：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_parentBiz"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">服务项编码：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_bizCode"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">服务项名称：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_bizName"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否为必备服务：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_isRequired"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">排序：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_sortNum"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_remark"></label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">服务包：</label>
                        <label class="col-sm-7 control-label control-label-content" id="lab_packageNames"></label>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-white" onclick="closeBizInfoPage();">取消</button>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/js/biz/childBizMgr.js?t=${now}"></script>
</body>
</html>

